<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<style>
		
	</style>
	<body>
		<div id="app">
			<!-- 1.语法过于繁琐 不推荐 -->
			<h2>{{fristName}} {{lastName}}</h2>
			
			<!-- 2.定义方法methods (执行了4次，影响性能) 不推荐 -->
			<h2>{{getFullName()}}</h2>
			<h2>{{getFullName()}}</h2>
			<h2>{{getFullName()}}</h2>
			<h2>{{getFullName()}}</h2>
			
			<!-- 3.定义计算属性computed (执行了1次，性能高) 推荐 -->
			<h2>{{fullName}}</h2>
			<h2>{{fullName}}</h2>
			<h2>{{fullName}}</h2>
			<h2>{{fullName}}</h2>
		</div>
		<script src="../js/vue.js"></script>
		<script>
			const vm = new Vue({
				el: "#app",
				data: {
					fristName: 'aaa',
					lastName: 'bbb'
				},
				methods: {
					getFullName: function(){
						console.log('getFullName');
						return this.fristName + ' ' + this.lastName;
					}
				},
				computed: {
					fullName: function(){
						console.log('fullName');
						return this.fristName + ' ' + this.lastName;
					}
				}
			});
		</script>
	</body>
</html>